package calculations;

public class PowerOfANumber {
	
	private static double pow(int x, int n) {
		
		if (n > 1) {
			if ((n & 1) > 0) {
				return x * pow(x*x, n/2);
			} else {
				return pow(x*x, n/2);
			}
		} else {
			return n == 0 ? 1 : x;
		}
	}
	
	public static void main(String args[]) {

		System.out.println(pow(2, 10));
		
		
		System.out.println(pow(2, 11));
	}
}
